using System;
using System.IO;
using UnityEditor;
using UnityEngine;

namespace MT_ToolKit
{
    /// <summary>
    /// 压缩Unity包
    /// </summary>
    public class CompressPackage
    {
        [MenuItem("MT_ToolKit/打UnityPackage包 %q")]
        public static void CompressUnityPackage()
        {
            GUIUtility.systemCopyBuffer = "MT_ToolKit_" + DateTime.Now.ToString("yyyyMMdd_HH");
            
            var assetPathName = "Assets/MT_ToolKit";
            var fileName = "MT_ToolKit_" + DateTime.Now.ToString("yyyyMMdd_hh") + ".unitypackage";
            //打包
            AssetDatabase.ExportPackage(assetPathName, fileName, ExportPackageOptions.Recurse);
            //打开文件夹
            Application.OpenURL("file:///" + Path.Combine(Application.dataPath, "../"));
        }

        public static void Note1()
        {
            //将文本存入复制
            GUIUtility.systemCopyBuffer = "qwe";
            //调用方法
            EditorApplication.ExecuteMenuItem("MT_ToolKit/打UnityPackage包");
        }
    }
}


